home *** CD-ROM | disk | FTP | other *** search
/ Amiga Times / AmigaTimes.iso / programme / Fiasco_2.2 / Databases / Mailing List Archive / scandir.frx < prev    next >
Encoding:
Text File  |  1998-10-06  |  1.7 KB  |  109 lines

  1. /* Scandir.frx
  2.  * Copyright © 1995-1998 Nils Bandener
  3.  * $VER: scandir_frx 8.1 (23.6.98)
  4.  */
  5.  
  6. Options Results
  7.  
  8. scriptname = "ScanDir / Mailing List Archive"
  9.  
  10. fiasco_port = address()
  11.  
  12. Signal on Syntax
  13. Signal on Halt
  14. Signal on Break_C
  15. Signal on Failure
  16.  
  17. LockGUI
  18.  
  19. /*
  20.  *  Get the directory to search in
  21.  */
  22.  
  23. RequestFile Drawersonly
  24.  
  25. if rc = 0 then do
  26.  
  27.     /*
  28.      *  User did not cancel the requester
  29.      */
  30.  
  31.     directory = Result
  32.  
  33.     /*
  34.      *  Create a list
  35.      */
  36.  
  37.     say "Scanning directory..."
  38.  
  39.     Address Command 'list >t:fpdb_files "' || directory || '" lformat %s%s files pat ~(#?.info) '
  40.  
  41.     if rc = 0 then
  42.     do
  43.  
  44.         say "Adding mails... (Press Ctrl-C for break)"
  45.  
  46.         if Open("g", "t:fpdb_files", "read") then do
  47.  
  48.             do while ~eof("g")
  49.                 file = ReadLn("g")
  50.  
  51.                 if file ~= "" then
  52.                 do
  53.                     call importmail.frx(file)
  54.                 end
  55.             end
  56.  
  57.             call Close("g")
  58.         end
  59.     end
  60. end
  61.  
  62. bail_out:
  63.  
  64. Address Value fiasco_port
  65.  
  66. UnlockGUI
  67. ResetStatus
  68.  
  69. exit
  70.  
  71. syntax:
  72. failure:
  73.  
  74. if show("Ports", fiasco_port) then
  75. do
  76.     Address Value fiasco_port
  77.  
  78.     RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
  79. end
  80. else
  81. do
  82.     say "Error" rc "in line" sigl ":" errortext(rc)
  83.     say "Enter to continue"
  84.     pull dummy
  85. end
  86.  
  87. call bail_out
  88.  
  89. halt:
  90. break_c:
  91.  
  92. if show("Ports", fiasco_port) then
  93. do
  94.     Address Value fiasco_port
  95.  
  96.     RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
  97.  
  98.     if result = 0 then return
  99. end
  100. else
  101. do
  102.     say "*** Break"
  103.     say "Enter to continue"
  104.     pull dummy
  105. end
  106.  
  107. call bail_out
  108.  
  109.